<style lang="scss">
@import './index.scss';
</style>
<template>
    <div class="purse">
        <div class="top">
            <van-nav-bar title="我的钱包" left-arrow @click-left="onClickLeft" />
            <div class="text-box">
                <div class="texts">
                    <ul>
                        <li>
                            <h1>{{ num }}</h1>
                        </li>
                        <li>
                            <h6>H币</h6>
                        </li>
                    </ul>
                </div>
                <p style="font-size: 12px;color: white;margin-top: 10px;">满2000H币可提现</p>
            </div>
            <div class="money">
                <van-button style="width: 60px; height: 36px; font-size: 14px; color: #3087ea;" size="small"
                    @click="tx">提现</van-button>
                <van-button style="width: 60px; height: 36px; font-size: 14px;  color: #3087ea;" size="small"
                    @click="cz">充值</van-button>
            </div>
        </div>
        <div class="con">
            <div style="display: flex; align-items: center; justify-content: space-between;margin-bottom: 20px;">
                <div>
                    <h3>问诊咨询</h3>
                    <h5>2018.11.10</h5>
                </div>
                <div>
                    <h3 style="color: rgb(193, 7, 7);">{{ moneyA }}</h3>
                </div>
            </div>
            <div style="display: flex; align-items: center; justify-content: space-between;margin-bottom: 20px;">
                <div>
                    <h3>问诊咨询</h3>
                    <h5>2018.12.10</h5>
                </div>
                <div>
                    <h3 style="color: #3087ea;">{{ - moneyB }}</h3>
                </div>
            </div>
            <div><mywallet/></div>
        </div>
    </div>
</template>
<script setup lang="ts">
import { ref,watch } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()
const flage = ref(true)
const num = ref(10000)
localStorage.setItem('num', num.value.toString())
num.value = parseInt(localStorage.getItem('num') || '0')
// 使浏览器回到上一个访问的页面，实现类似于 “返回” 的功能
const onClickLeft = () => history.back();

const moneyA = ref(localStorage.getItem('moneyA'))
const moneyB = ref(localStorage.getItem('moneyB'))
// 提现 -
const tx = () => {
    flage.value = false
    router.push('/withdrawal')
}
// 充值 +
const cz = () => {
    flage.value = true
    router.push('/recharge')
     const additionalAmount =1
    moneyA.value += additionalAmount
}
</script>